home *** CD-ROM | disk | FTP | other *** search
Text File | 1992-06-09 | 41.9 KB | 1,305 lines |
- /* ----- BANG.C -------------------------------------------------------------
- *
- * DESCRIPTION:
- *
- * Sample Program for Destroying WinDoom errors
- * (that means everything)
- *
- * REMARKS:
- * Needed files are only the resource file PENG.RES.
- * Compilation without explicit .DEF file.
- *
- * CHANGES:
- *
- * V0.1 09-11-91 Heiner Eichmann
- * & Michael Schuschk
- * Desperate start of programming.
- *
- * V0.2 10-11-91 Heiner Eichmann
- * & Jⁿrgen Christ
- * Cleaned up program code and brought to first time
- * functioning (a real strong performance for a
- * pascal programmer). Shooting within and without the
- * window is possible.
- *
- * V0.25 12-11-91 Michael Schuschk
- * Fixed bug with crippled shots appearing when window
- * is iconized and resized again. Screen is saved at
- * program start and will be restored before ending the
- * program.
- *
- * V0.3 22-11-91 Heiner Eichmann
- * There's only an ABOUT dialog box and the sound
- * missing. All other things are the way we wanted
- * them.
- *
- * V0.35 24-11-91 Michael Schuschk
- * ABOUT box with informations about this ultimate
- * program added. Window size at first start is
- * now depending on the width of the text lines
- * appearing within the window.
- *
- * V0.4 25-11-91 Heiner Eichmann
- * Only slight corrections. Translation of text and
- * comments into english language. Now only the sound
- * is missing.
- *
- * V0.5 26-11-91 Michael Schuschk
- * Slight corrections on the ABOUT box and shooting
- * hole design. And new in this version: the first
- * appearance of sound! But until now it sounds only
- * like a gun with sound absorber. This "pop" will
- * possibly be caused by the StartSound() and
- * StopSound() functions.
- *
- * - Program goes into Beta-Test!
- *
- * V0.6 27-11-91 Jⁿrgen Christ & Heiner Eichmann
- * New cursor created. The word WinDoom was discovered
- * (Many thanks to Holger Eichmann). A small problem
- * with the distribution of the painted holes around
- * the cross-hair if fixed. The About About... window
- * was created. Problems with the aboutbitmap.
- *
- * V1.0 03-12-91 Heiner Eichmann
- * Problems with the aboutabout-resource ignored. Light
- * changes of the sound-commands. CloseSound() bug fixed.
- * Version number changed to 1.0!!!!! Install and
- * document created. Program is now ready to mail.
- *
- * V1.1 18-04-92 Jⁿrgen Christ
- * Sound is now produced through Mulimedia-Controller-
- * Interface (MCI). Great digitized sound via
- * Soundblaster or similar WAVEFORM-devices.
- *
- * V1.11 19-04-92 Heiner Eichmann and Jⁿrgen Christ
- * First appearence of the Hasta-La-Vista-Sound! We should
- * not mention, what movie is our favorite, should we!?
- *
- * V1.2 20-04-92 Jⁿrgen Christ
- * All soundparameters can be installed via config-dialog.
- * BANG uses for the first time WIN.INI without adding ONLY
- * rubbish. :-)
- *
- * V1.21 20-04-92 Heiner Eichmann
- * Added enhanced grenade-functions, fixed problems with
- * Hasta-la-Vista-Sound at the end of firing.
- *
- * - Program goes into Beta-Test!
- *
- * V1.3 21-04-92 Jⁿrgen Christ
- * Added statistics-box - counts your hits on WINDOOM!
- *
- * V1.35 21-04-92 Heiner Eichmann
- * He IS the bug-hunter!!! :-) Uncounted minor errors fixed in
- * several cases.
- *
- * V1.4 26-04-92 Heiner Eichmann
- * Time event structure changed and autoinit procedure added
- *
- * V1.5 02-05-92 Jⁿrgen Christ
- * BANG looks for a MCI-Driver which kann play waves! Otherwise BANG
- * playes some PC-QuΣker-Sounds!
- *
- * V1.6 03-05-92 Jⁿrgen Christ and Heiner Eichmann
- * Help-Menue added and Help-text created.
- * This part brought much fun! :-)
- *
- * V1.7 10-05-92 Heiner Eichmann
- * Program structure changed. Now not more than 3 DC are
- * open. ... This was NOT the cause of the "Mystic crashes".
- *
- * V1.75 16-05-92 Heiner Eichmann
- * We forgot the EndPaint function under WM_PAINT.
- * ARGHNF - This was the cause of the mystic crashes !!
- *
- * V1.76 17-05-92 Heiner Eichmann
- * Small MCI-Bug removed: MCI-Driver is now available after
- * iconizing and resizing BANG
- *
- * - Program goes into Beta-Test!
- *
- * V1.80 20-05-92 Heiner Eichmann
- * I give up ! WinDoom is too clever. Each procedure to prevent
- * sound errors is bypassed by Windoom. Therefore the Sound Mode
- * entry in Config has to be created.
- *
- * V1.81 22-05-92 Heiner Eichmann
- * The Combo-box is working and the auto-detect routine is
- * improved
- *
- * V1.90 31-05-92 Heiner Eichmann & Jⁿrgen Christ
- * It's finally working!
- * BANG now stops all playing WAVEs.
- * Thanks to sndPlaySound!!!
- *
- * V1.91 31-05-92 Heiner Eichmann
- * Two minor Bugs fixed
- *
- * - Program goes into final Beta-Test !
- *
- * V1.92 06-06-92 Jⁿrgen Christ
- * Minor Bug-Fix in Windows-Help-Procedure call.
- *
- * V1.95 07-06-92 Jⁿrgen Christ
- * Implementation of a REAL RestoreScreen-Funktion using
- * Windows 3.1-features! It has lasted long, really long!!
- *
- * V2.0 09-06-92 Heiner Eichmann, Jⁿrgen Christ
- * Final changes (all BETA's removed, logo changed).
- * BANG 2.0 is released to the public !!!!
- *
- * The last problem: is there any known rule in the way we are giving the
- * version numbers ???
- *
- *
- * INCLUDES:
- */
- #include <windows.h>
- #include <string.h>
- #include <stdlib.h>
- #include <stdio.h>
- /*
- * DEFINES:
- */
-
- /* Defines and types from MMSYSTEM.H of the Multimedia-SDK from Mickersoft
- in the damned fucking Mickersoft-format!!!
- */
-
- #define MCI_STRING_OFFSET 512
- #define MCI_VD_OFFSET 1024
- #define MCI_CD_OFFSET 1088
- #define MCI_WAVE_OFFSET 1152
- #define MCI_SEQ_OFFSET 1216
- #define MCI_ALL_DEVICE_ID 0xFFFF
-
- #define MCI_DEVTYPE_WAVEFORM_AUDIO (MCI_STRING_OFFSET + 10)
-
- // MCI command message identifiers
- #define MCI_OPEN 0x0803
- #define MCI_CLOSE 0x0804
- #define MCI_ESCAPE 0x0805
- #define MCI_PLAY 0x0806
- #define MCI_SEEK 0x0807
- #define MCI_STOP 0x0808
- #define MCI_PAUSE 0x0809
- #define MCI_INFO 0x080A
- #define MCI_GETDEVCAPS 0x080B
- #define MCI_SPIN 0x080C
- #define MCI_SET 0x080D
- #define MCI_STEP 0x080E
- #define MCI_RECORD 0x080F
- #define MCI_SYSINFO 0x0810
- #define MCI_BREAK 0x0811
- #define MCI_SOUND 0x0812
- #define MCI_SAVE 0x0813
- #define MCI_STATUS 0x0814
- #define MCI_CUE 0x0830
- #define MCI_REALIZE 0x0840
- #define MCI_WINDOW 0x0841
- #define MCI_PUT 0x0842
- #define MCI_WHERE 0x0843
- #define MCI_FREEZE 0x0844
- #define MCI_UNFREEZE 0x0845
- #define MCI_LOAD 0x0850
- #define MCI_CUT 0x0851
- #define MCI_COPY 0x0852
- #define MCI_PASTE 0x0853
- #define MCI_UPDATE 0x0854
- #define MCI_RESUME 0x0855
- #define MCI_DELETE 0x0856
-
- // all custom MCI command messages must be >= than this value
- #define MCI_USER_MESSAGES (0x400 + DRV_MCI_FIRST)
-
- // return values for 'status mode' command
- #define MCI_MODE_NOT_READY (MCI_STRING_OFFSET + 12)
- #define MCI_MODE_STOP (MCI_STRING_OFFSET + 13)
- #define MCI_MODE_PLAY (MCI_STRING_OFFSET + 14)
- #define MCI_MODE_RECORD (MCI_STRING_OFFSET + 15)
- #define MCI_MODE_SEEK (MCI_STRING_OFFSET + 16)
- #define MCI_MODE_PAUSE (MCI_STRING_OFFSET + 17)
- #define MCI_MODE_OPEN (MCI_STRING_OFFSET + 18)
-
- // flags for dwFlags parameter of MCI_SYSINFO command message
- #define MCI_SYSINFO_QUANTITY 0x00000100L
- #define MCI_SYSINFO_OPEN 0x00000200L
- #define MCI_SYSINFO_NAME 0x00000400L
- #define MCI_SYSINFO_INSTALLNAME 0x00000800L
-
- // Sound support
- // flag values for wFlags parameter
- #define SND_SYNC 0x0000 // play synchronously (default)
- #define SND_ASYNC 0x0001 // play asynchronously
- #define SND_NODEFAULT 0x0002 // don't use default sound
- #define SND_MEMORY 0x0004 // lpszSoundName points to a memory file
- #define SND_LOOP 0x0008 // loop the sound until next sndPlaySound
- #define SND_NOSTOP 0x0010 // don't stop any currently playing sound
-
- // parameter block for MCI_SYSINFO command message
- typedef struct {
- DWORD dwCallback;
- LPSTR lpstrReturn;
- DWORD dwRetSize;
- DWORD dwNumber;
- WORD wDeviceType;
- WORD wReserved0;
- } MCI_SYSINFO_PARMS;
- typedef MCI_SYSINFO_PARMS FAR * LPMCI_SYSINFO_PARMS;
-
- /* Own defines */
-
- #define STARTPOSX CW_USEDEFAULT
- #define STARTPOSY CW_USEDEFAULT
- #define RANGEXDIV 20
- #define RANGEYDIV 20
- #define ENDDELAY 100 /* Delay between two accesses to the MCI driver */
- #define GRENADEDELAY 1500 /* Delay between trigger and Explosion */
- #define EXPLOSIONDELAY 3 /* Delay for speaker explosion */
- #define EXPLOSIONNUMBER 10 /* Number of soundchanges during explosion */
- #define HALF_SIZE 8 /* Size of icon LOCH div 2 */
- #define IDM_SYSABOUT 4242
- #define ID_OK 101
- #define IDM_ABOUTABOUT 6942
-
- /* timer events: */
-
- #define PENG 1 /* time between two shots */
- #define GRENADE 2 /* time between right trigger and explosion */
- #define ENDGRENADE 3 /* time between explosion and end of sound */
- #define HASTALAVISTA 4 /* time between right double click and end of sound */
-
- #define IDM_CONFIG 4711
- #define ID_SAVE 108
- #define ID_FORGET 109
- #define ID_SPEED 104
- #define ID_SLIDER 105
- #define ID_GRENADEDELAY 106
- #define ID_MG 111
- #define ID_GT 112
- #define ID_HLVB 113
- #define ID_PATHTOSOUND 114
- #define ID_SOUNDMODE 115
-
- #define IDM_STATS 815
- #define ID_RESET 102
- #define ID_SHOTS 103
- #define ID_GRENADES 104
-
- #define IDM_HELP 1811
- /*
- * EXTERNAL:
- */
- /*
- * TYPES:
- */
- /*
- * VARIABLES:
- */
- HCURSOR hcursor, gaehn_cursor;
- HANDLE scheiss_c;
- HDC screen_hdc, hdcmem;
- HBITMAP screen_bitm, hole_bitm, grenade_bitm;
- POINT ptSize_hole, ptSize_grenade, ptOrg;
- BITMAP bm;
- short cxSize, cySize;
- int rangex, rangey;
- int GrenadeDelay=GRENADEDELAY;
- int oldgrenade;
- int grenade_x, grenade_y; /* position of grenade hit */
- int grenade_ready; /* ready to shoot */
- char OldInfoStr[42]; /* WinDoom-into-the-trashcan information */
- int treffer_flag,
- hdc_in_use = FALSE;
- int iMaxZeile; /* Maximum width of text in pixel */
- short cxChar, cxCaps, cyCaps; /* Dimensions of one char of actual
- system font */
- HWND hSlider; /* Handle to a slider */
- int FirePlace; /* Update - variable */
-
- int ShotsOnWinDoom; /* Hits on the Desktop */
- int ThrownGrenades;
- int WAVerror; /* True, if an error occures */
- int soundinstalled; /* speakersound installed */
- int MCIDriverInstalled; /* what could this mean ? */
- int first_play_command;
- int MCImode; /* Mci modes: */
- #define AUTO 0
- #define SPEAKER 1
- #define MCIDEVICE 2
- char SoundModeStrings[3][10]={
- "AUTO","SPEAKER","MCIDEVICE"};
-
- int speaker_explosion; /* grenade ie exploding (for speaker sound only) */
- int explosion_counter; /* counter for speaker-explosion sound */
-
-
- #define LINENUMS 9
- char acText[LINENUMS][100] = {
- "Death to Mickeysoft Version 2.0",
- "",
- "The program, everyone was waiting for",
- "",
- "Left mousebutton: Fire MG!",
- "Right mousebutton: Fire Grenade!",
- "Right doubleclick: Back to work.",
- "",
- "Written by REMBRANDT, POWER MIKE and JOSH."};
-
- /* Variables for WIN.INI access */
- int HowMuch;
- char WhereBang[51];
- char MachineGun[13];
- char GrenadeThrower[13];
- char HastaLaVista[13];
- char strGrenadeDelay[10];
- char strFireSpeed[10];
- char strSoundMode[20];
- int FireSpeed;
-
- /*
- * PROTOTYPES
- */
- int PASCAL WinMain (HANDLE, HANDLE, LPSTR, int);
- long FAR PASCAL _export WindowProcedure (HWND, unsigned, WORD, LONG);
- BOOL FAR PASCAL AboutBox(HWND, unsigned, WORD, LONG);
- BOOL FAR PASCAL ConfigBox(HWND, unsigned, WORD, LONG);
- BOOL FAR PASCAL StatistikBox(HWND, unsigned, WORD, LONG);
-
- /* MMSYSTEM.DLL - imports MCI-functions */
- DWORD FAR PASCAL MciSendString(LPSTR, LPSTR, WORD, HWND);
- BOOL FAR PASCAL MciGetErrorString(DWORD, LPSTR, WORD);
- DWORD FAR PASCAL MciSendCommand (WORD, WORD, DWORD, DWORD);
- BOOL FAR PASCAL sndPlaySound(LPSTR lpszSoundName, WORD wFlags);
-
- /* Spezielle Windows 3.1 Funktionen */
- BOOL FAR PASCAL RedrawWindow (HWND hwnd, const RECT FAR* lprcUpdate, HRGN hrgnUpdate, WORD flags);
-
- #define RDW_INVALIDATE 0x0001
- #define RDW_INTERNALPAINT 0x0002
- #define RDW_ERASE 0x0004
-
- #define RDW_VALIDATE 0x0008
- #define RDW_NOINTERNALPAINT 0x0010
- #define RDW_NOERASE 0x0020
-
- #define RDW_NOCHILDREN 0x0040
- #define RDW_ALLCHILDREN 0x0080
-
- #define RDW_UPDATENOW 0x0100
- #define RDW_ERASENOW 0x0200
-
- #define RDW_FRAME 0x0400
- #define RDW_NOFRAME 0x0800
-
-
-
- /*
- * RETURN:
- *
- * CALL AND PARAMETERS:
- */
- /*
- *
- * ------------------------------------------------------------------------ */
-
- /* ----- WinMain ----------------------------------------------------------
- *
- * Windows Entry Function
- * ---------------------------------------------------------------------- */
-
- int PASCAL WinMain (hInstance, hPrevInstance, lpszCmdLine, nCmdShow)
-
- #pragma argsused
-
- HANDLE hInstance; /* Actual instance */
- HANDLE hPrevInstance; /* Preious instance */
- LPSTR lpszCmdLine; /* Command line parameter */
- int nCmdShow; /* Window or icon? */
-
- {
- HWND hWindow; /* Window handle */
- HMENU hSysMenu; /* System menu handle */
- MSG Message; /* Message struct */
- WNDCLASS WindowClass; /* Window class */
- TEXTMETRIC tm; /* Text dimensions */
- HDC hdcSystemDC; /* Screen display context */
- static char acName[] = "hallo"; /* window class name */
- int i; /* Counter, what else? */
- char WindowsPath[144]; /* Where is Windows? */
- FILE *wininifile;
- char winini[200];
-
- /* Already an application of the same type running? */
- scheiss_c = hInstance;
- grenade_ready = TRUE;
- MCIDriverInstalled = FALSE;
- soundinstalled = FALSE;
- first_play_command = TRUE;
- treffer_flag = 0;
- if (!hPrevInstance) {
- WindowClass.style = CS_VREDRAW | CS_HREDRAW | CS_DBLCLKS;
- WindowClass.lpfnWndProc = WindowProcedure;
- WindowClass.cbClsExtra = 0;
- WindowClass.cbWndExtra = 0;
- WindowClass.hInstance = hInstance;
- WindowClass.hIcon = LoadIcon (hInstance, (LPSTR) "MegaIcon");
- WindowClass.hCursor = LoadCursor (hInstance, (LPSTR) "GAEHN");
- WindowClass.hbrBackground = GetStockObject (WHITE_BRUSH);
- WindowClass.lpszMenuName = NULL;
- WindowClass.lpszClassName = acName;
-
- /* Already existing a window of the same class? */
- if (!RegisterClass (&WindowClass))
- return (FALSE);
-
- }
-
- /* Get dimensions of an capital char of the actual system font */
- hdcSystemDC = CreateDC("DISPLAY", NULL, NULL, NULL);
- GetTextMetrics(hdcSystemDC, &tm);
- cxChar = tm.tmAveCharWidth;
- cxCaps = (tm.tmPitchAndFamily & 1 ? 3 : 2) * cxChar / 2;
- cyCaps = tm.tmHeight + tm.tmExternalLeading;
-
- /* Get maximum with of one text row in pixels */
- iMaxZeile = 0;
- for (i = 0; i < LINENUMS; i++)
- iMaxZeile = max(iMaxZeile, LOWORD(GetTextExtent(hdcSystemDC,
- acText[i], strlen(acText[i]))));
-
- DeleteDC(hdcSystemDC);
-
- /* Create window */
- hWindow = CreateWindow (acName, /* Window class name */
- "Death to Mickeysoft", /* Window title */
- WS_OVERLAPPED /* Window style */
- |WS_CAPTION|WS_SYSMENU
- |WS_MINIMIZEBOX,
- STARTPOSX, /* Window start */
- STARTPOSY, /* position and */
- iMaxZeile + 10, /* size */
- cyCaps * (LINENUMS + 2),
- NULL,
- NULL,
- hInstance,
- NULL);
-
- /* Append menu entry for About... function */
- hSysMenu = GetSystemMenu(hWindow, FALSE);
- AppendMenu(hSysMenu, MF_SEPARATOR, 0, NULL);
- AppendMenu(hSysMenu, MF_STRING, IDM_CONFIG, "Configuration");
- AppendMenu(hSysMenu, MF_STRING, IDM_STATS, "Statistics");
- AppendMenu(hSysMenu, MF_SEPARATOR, 0, NULL);
- AppendMenu(hSysMenu, MF_STRING, IDM_HELP, "HELP!");
- AppendMenu(hSysMenu, MF_STRING, IDM_SYSABOUT, "About Bang...");
- AppendMenu(hSysMenu, MF_STRING, IDM_ABOUTABOUT, "About About...");
-
- /* Show Window */
- ShowWindow (hWindow, SW_SHOWMINIMIZED);
- UpdateWindow (hWindow);
-
- /* Load Recources */
- hcursor = LoadCursor(hInstance, "MegaCursor");
- gaehn_cursor = LoadCursor(hInstance, "GAEHN");
- hole_bitm = LoadBitmap(hInstance, "LOCH");
- grenade_bitm = LoadBitmap(hInstance, "GRENADE");
-
- GetWindowsDirectory(WindowsPath,144);
- if (WindowsPath[strlen(WindowsPath)]=='\\')
- WindowsPath[strlen(WindowsPath)]='\0';
- HowMuch=GetProfileString("BANG", NULL, NULL, (LPSTR)WhereBang, 51);
-
- if (HowMuch == 0)
- {
- strcpy(winini,WindowsPath);
- strcat(winini,"\\win.ini");
- wininifile = fopen(winini,"at");
-
- fprintf(wininifile,"\n[BANG]\n\n");
- fprintf(wininifile, " BBBBBB AA N N GGGGGG\n");
- fprintf(wininifile, " B B A A NN N G\n");
- fprintf(wininifile, " B B A A N N N G\n");
- fprintf(wininifile, " BBBBBB A A N N N G GGG\n");
- fprintf(wininifile, " B B AAAAAAAA N N N G G\n");
- fprintf(wininifile, " B B A A N NN G G\n");
- fprintf(wininifile, " BBBBBB A A N N GGGGGG\n\n");
- fprintf(wininifile, "Written by REMBRANDT, POWER MIKE and JOSH\n\n");
- fprintf(wininifile, "Each WinDoom application is adding some rubbish to the WIN.INI\n");
- fprintf(wininifile, "file. This one too !!!\n\n");
- fprintf(wininifile, "Enjoy it\n\n");
- strcpy(winini,"WhereBang = ");
- strcat(winini,WindowsPath);
- strcat(winini,"\n");
- fprintf(wininifile, winini);
- fprintf(wininifile, "MachineGun = BANGGUN.WAV\n");
- fprintf(wininifile, "GrenadeThrower = BANGGREN.WAV\n");
- fprintf(wininifile, "HastaLaVista = BANGHLVB.WAV\n");
- fprintf(wininifile, "FireSpeed = 500\n");
- fprintf(wininifile, "GrenadeDelay = %d\n",GRENADEDELAY);
- fprintf(wininifile, "SoundMode = AUTO\n");
- fclose(wininifile);
- WriteProfileString("BANG","HastaLaVista","BANGHLVB.WAV");
- }
-
- sprintf(strGrenadeDelay,"%u",GRENADEDELAY);
- HowMuch=GetProfileString("BANG", "WhereBang", (LPSTR)WindowsPath, (LPSTR)WhereBang, 51);
- HowMuch=GetProfileString("BANG", "MachineGun", "DING.WAV", (LPSTR)MachineGun, 13);
- HowMuch=GetProfileString("BANG", "GrenadeThrower", "DING.WAV", (LPSTR)GrenadeThrower, 13);
- HowMuch=GetProfileString("BANG", "HastaLaVista", "DING.WAV", (LPSTR)HastaLaVista, 13);
- HowMuch=GetProfileString("BANG", "Firespeed", "100", (LPSTR)strFireSpeed, 10);
- HowMuch=GetProfileString("BANG", "SoundMode", "AUTO", (LPSTR)strSoundMode, 10);
- HowMuch=GetProfileString("BANG", "GrenadeDelay", strGrenadeDelay, (LPSTR)strGrenadeDelay, 10);
- FireSpeed=atoi(strFireSpeed);
- GrenadeDelay=atoi(strGrenadeDelay);
- MCImode=AUTO;
- if (strcmpi(strSoundMode,SoundModeStrings[SPEAKER]) == 0) MCImode = SPEAKER;
- if (strcmpi(strSoundMode,SoundModeStrings[MCIDEVICE]) == 0) MCImode = MCIDEVICE;
-
- ShotsOnWinDoom=0;
- ThrownGrenades=0;
-
- /* message loop */
- while (GetMessage (&Message, NULL, 0, 0) )
- {
- TranslateMessage (&Message);
- DispatchMessage (&Message);
- }
-
- UnregisterClass(WindowClass.lpszClassName,WindowClass.hInstance);
-
- return (Message.wParam);
-
- } /* this was win main ... */
-
- /* ---------------------------------------------------------------------- */
-
-
- void InitSpeakerSound(void)
- {
- if (!soundinstalled)
- {
- OpenSound();
- soundinstalled = TRUE;
- SetSoundNoise(S_WHITE2048, 5);
- SetVoiceQueueSize(1, 1000);
- SetVoiceAccent(1, 200, 30, S_NORMAL, 40);
- }
-
- }
-
-
- /* ----- OwnMciSendString -----------------------------------------------
- *
- * Sends MCI Strings and handles errors
- * ---------------------------------------------------------------------- */
-
- long PASCAL OwnMciSendString(char *SendStr, char *Information, WORD LengthInfo, WORD hCallback,
- char *Errorstr)
-
- {
- long RetSend;
- char errorstr[255], printstr[300];
- int CheckError, playcommand;
-
- RetSend = 0;
- playcommand=(SendStr[0]=='p' && SendStr[1]=='l' && SendStr[2]=='a' && SendStr[3]=='y');
- CheckError = (!(strcmp(Errorstr,"dont check")==0)&&(MCImode==AUTO))
- ||((MCImode==AUTO)&&playcommand&&first_play_command);
- if (!WAVerror)
- {
- // MessageBox(NULL,SendStr,"Zu sendender String", MB_ICONSTOP | MB_TASKMODAL | MB_OK);
- RetSend = MciSendString(SendStr, Information, LengthInfo, hCallback);
- if ((RetSend != 0) && CheckError)
- {
- InitSpeakerSound();
- WAVerror = TRUE;
- MCIDriverInstalled = FALSE;
-
- MciGetErrorString(RetSend,errorstr,255);
- strcpy(printstr,"Error location: ");
- strcat(printstr,Errorstr);
- strcat(printstr,"\n\n");
- strcat(printstr,"Command: ");
- strcat(printstr,SendStr);
- strcat(printstr,"\n\n");
- strcat(printstr,"Errormessage: ");
- strcat(printstr,errorstr);
- if (!(strcmp(Errorstr,"")==0)&&!(playcommand&&first_play_command))
- MessageBox(NULL, printstr,"MCI-Error message",MB_TASKMODAL | MB_ICONSTOP | MB_OK);
-
- }
- }
- else if (MCImode == MCIDEVICE)
- MciSendString(SendStr, Information, LengthInfo, hCallback);
- if (playcommand) first_play_command = FALSE;
- return(RetSend);
- }
-
-
- /* ---------------------------------------------------------------------- */
-
-
- /* ----- BallerBumm -----------------------------------------------------
- *
- * Do the great bang one time
- * ---------------------------------------------------------------------- */
- void krawumm(WhatBaller)
-
- int WhatBaller;
-
- {
- int posx, posy;
- int i;
- POINT ptcursorpos;
- HDC hdcvar; /* multi purpose handle */
-
- switch (WhatBaller)
- {
- case 1:
- GetCursorPos((LPPOINT)&ptcursorpos);
- posx = ptcursorpos.x - rangex / 2 - HALF_SIZE;
- posy = ptcursorpos.y - rangey / 2 - HALF_SIZE;
- treffer_flag = -1;
-
- /* Display shooting hole */
-
- hdcvar = CreateCompatibleDC(screen_hdc);
- SelectObject(hdcvar, hole_bitm);
- SetMapMode(hdcvar, GetMapMode(screen_hdc));
- DPtoLP(hdcvar, &ptSize_hole, 1);
- BitBlt(screen_hdc, posx+random(rangex), posy+random(rangex), ptSize_hole.x,
- ptSize_hole.y, hdcvar, ptOrg.x, ptOrg.y, SRCAND);
- DeleteDC(hdcvar);
-
-
- ShotsOnWinDoom++;
-
- /* Play digitized sound via prepared MCI */
- OwnMciSendString("play bumm from 0",(LPSTR)NULL,0,0,"dont check");
- if (soundinstalled && (!speaker_explosion))
- {
- SetVoiceSound(1, (long)(500) << 16, 1);
- StartSound();
- }
- break;
- case 2:
- treffer_flag = -1;
-
- /* Display grenade hole */
-
- hdcvar = CreateCompatibleDC(screen_hdc);
- SelectObject(hdcvar, grenade_bitm);
- SetMapMode(hdcvar, GetMapMode(screen_hdc));
- DPtoLP(hdcvar, &ptSize_grenade, 1);
-
- BitBlt(screen_hdc, grenade_x, grenade_y, ptSize_grenade.x,
- ptSize_grenade.y, hdcvar, ptOrg.x, ptOrg.y, SRCAND);
-
- DeleteDC(hdcvar);
-
- ThrownGrenades++;
- break;
- }
-
- }
- /* ---------------------------------------------------------------------- */
-
- /* ----- InitMciDriver --------------------------------------------------
- *
- * Prepares the MCI-driver
- * ---------------------------------------------------------------------- */
- void InitMciDriver()
-
- {
- char str[100];
- char test[100];
- char open[100];
-
- FILE *t;
-
- /* Are there any devices present which can play waves? */
- DWORD Device_Count;
-
- MCI_SYSINFO_PARMS Info;
-
- if ((!MCIDriverInstalled) && (MCImode == AUTO) || (MCImode == MCIDEVICE))
- {
- Info.dwCallback=NULL;
- Info.lpstrReturn=(LPSTR)(LPDWORD)&Device_Count;
- Info.dwRetSize=sizeof(Device_Count);
- Info.wDeviceType=MCI_DEVTYPE_WAVEFORM_AUDIO;
- /* All wave-devices - lift your finger! */
- MciSendCommand(NULL,MCI_SYSINFO,MCI_SYSINFO_QUANTITY,(DWORD)(LPMCI_SYSINFO_PARMS)&Info);
- /* ^^^ Oh my god! I like those CASTs - really funny! */
- MCIDriverInstalled=(Device_Count>0);
-
- /* That┤s it! */
-
- if (MCIDriverInstalled)
- {
- wsprintf((LPSTR)test,"%s\\patsch.wav",(LPSTR)WhereBang);
- if ((t=fopen(test,"r"))==NULL)
- sndPlaySound(NULL,SND_SYNC);
- else
- {
- fclose(t);
- sndPlaySound((LPSTR)test,SND_SYNC);
- }
-
- WAVerror = FALSE;
- wsprintf((LPSTR)open,"open %s\\", (LPSTR)WhereBang);
-
- strcpy(test,open);
- strcat(test,MachineGun);
- strcat(test," type waveaudio alias bumm");
-
- OwnMciSendString((LPSTR)test,(LPSTR)NULL,0,0,"");
-
- strcpy(test,open);
- strcat(test,GrenadeThrower);
- strcat(test," type waveaudio alias krawumm");
-
- OwnMciSendString((LPSTR)test,(LPSTR)NULL,0,0,"Error 1");
-
- strcpy(test,open);
- strcat(test,HastaLaVista);
- strcat(test," type waveaudio alias hlvb");
-
- OwnMciSendString((LPSTR)test,(LPSTR)NULL,0,0,"Error 2");
-
- }
- }
- }
- /* ---------------------------------------------------------------------- */
-
- /* ----- CloseMciDriver -------------------------------------------------
- *
- * Closes the MCI-driver
- * ---------------------------------------------------------------------- */
- void CloseMciDriver()
- {
- if (MCIDriverInstalled)
- {
- MCIDriverInstalled = FALSE;
- OwnMciSendString("close bumm",(LPSTR)NULL,0,0,"Error 3");
- OwnMciSendString("close krawumm",(LPSTR)NULL,0,0,"Error 4");
- OwnMciSendString("close hlvb",(LPSTR)NULL,0,0,"Error 5");
- }
- }
- /* ----------------------------------------------------------------------
- restorescreen() rebuilds the whole screen including desktop, icons,
- windows and children of the windows! Don't ask, why mickeysoft has not
- build in the function "RedrawWindow()" before Windows 3.1?!?!
- Look out for BANG 1.0 and the solution without "RedrawWindow"-function!
- It's funny!
- ---------------------------------------------------------------------- */
-
- void restorescreen()
- {
- if (treffer_flag)
- {
- InvalidateRgn(GetDesktopWindow(),NULL,TRUE);
- RedrawWindow(NULL,NULL,NULL,RDW_UPDATENOW | RDW_FRAME | RDW_INVALIDATE | RDW_ALLCHILDREN | RDW_INTERNALPAINT);
- treffer_flag = 0;
- }
- }
-
- long FAR PASCAL _export WindowProcedure (hWnd, uiMessage, wParam, lParam)
-
- HWND hWnd; /* Window handle */
- unsigned uiMessage; /* Message number */
- WORD wParam; /* wParam and lParam contain */
- LONG lParam; /* additional information */
-
- {
- HDC hDisplayContext; /* Display context handle
- for window function */
- PAINTSTRUCT PaintStructure; /* Info for window
- repainting */
- HDC hdcvar; /* multi purpose handle */
- int i;
- POINT ptcursorpos;
- static int ballerbumm = 0;
- static int cxClientArea, cyClientArea;
- /* Width and height of
- client area */
- static int cyOffset; /* Vertical offset for text
- display */
- FARPROC lpAboutProc; /* Pointer to the About
- dialog box function */
- FARPROC lpConfigProc; /* Pointer to the config
- box function */
- FARPROC lpStatistikProc; /* Pointer to the statstic
- box function */
- char InfoStr[42]; /* additional information */
- char test[100]; /* all round - variable */
-
- switch (uiMessage){
- case WM_CREATE :
- /* Get screen dimensions */
- cxSize = GetSystemMetrics(SM_CXSCREEN);
- cySize = GetSystemMetrics(SM_CYSCREEN);
-
- /* Back to where the action is... */
- return(0);
- case WM_SIZE :
- /* Get client area width and height for centered
- text display */
- cxClientArea = LOWORD(lParam);
- cyClientArea = HIWORD(lParam);
-
- if (wParam == SIZENORMAL) {
- SetCursor(hcursor);
- SetCapture(hWnd);
- ballerbumm = 1;
- speaker_explosion = FALSE;
- grenade_ready = TRUE;
- soundinstalled = FALSE;
- if (!hdc_in_use)
- {
- screen_hdc = CreateDC("DISPLAY", NULL, NULL, NULL);
- hdcmem = CreateCompatibleDC(screen_hdc);
- cxSize = GetSystemMetrics(SM_CXSCREEN);
- rangex = cxSize / RANGEXDIV;
- cySize = GetSystemMetrics(SM_CYSCREEN);
- rangey = cySize / RANGEYDIV;
- screen_bitm = CreateCompatibleBitmap(screen_hdc,
- cxSize, cySize);
- SelectObject(hdcmem, screen_bitm);
- ptOrg.x = 0;
- ptOrg.y = 0;
- DPtoLP (hdcmem, &ptOrg, 1);
-
- hdcvar = CreateCompatibleDC(screen_hdc);
- SelectObject(hdcvar, grenade_bitm);
- SetMapMode(hdcvar, GetMapMode(screen_hdc));
- GetObject(grenade_bitm, sizeof(BITMAP), (LPSTR) &bm);
- ptSize_grenade.x = bm.bmWidth;
- ptSize_grenade.y = bm.bmHeight;
- DPtoLP(hdcvar, &ptSize_grenade, 1);
- DeleteDC(hdcvar);
-
- hdcvar = CreateCompatibleDC(screen_hdc);
- SelectObject(hdcvar, hole_bitm);
- SetMapMode(hdcvar, GetMapMode(screen_hdc));
- GetObject(hole_bitm, sizeof(BITMAP), (LPSTR) &bm);
- ptSize_hole.x = bm.bmWidth;
- ptSize_hole.y = bm.bmHeight;
- DPtoLP(hdcvar, &ptSize_hole, 1);
- DeleteDC(hdcvar);
- hdc_in_use = TRUE;
- }
-
- /* Prepare Multimedia-Controller */
-
- WAVerror = TRUE;
- InitMciDriver();
- if (MCImode == SPEAKER) InitSpeakerSound();
-
- }
- if (wParam == SIZEICONIC) {
-
- /* And now delete the bunch of device
- contexts, because there are only 6 of
- them system wide */
- KillTimer(hWnd,HASTALAVISTA);
- if (hdc_in_use)
- {
- DeleteDC(hdcvar);
- DeleteDC(hdcmem);
- hdc_in_use = FALSE;
- }
- restorescreen();
- CloseMciDriver();
- }
- break;
- case WM_PAINT :
- hDisplayContext = BeginPaint (hWnd, &PaintStructure);
-
- /* Get vertical offset for text display */
- cyOffset = max(0, cyClientArea - (LINENUMS * cyCaps));
-
- /* Display text centered in window */
- for (i = 0; i < LINENUMS; i++){
- SetTextAlign(hDisplayContext, TA_CENTER | TA_TOP);
- TextOut (hDisplayContext, cxClientArea / 2,
- cyOffset+(i * cyCaps), acText[i],
- (int)strlen(acText[i]));
- SetTextAlign(hDisplayContext, TA_LEFT | TA_TOP);
- }
- EndPaint(hWnd, &PaintStructure);
- break;
- case WM_LBUTTONUP :
- if (soundinstalled)
- StopSound();
- KillTimer(hWnd, PENG);
- return(0);
- case WM_TIMER :
- switch (wParam)
- {
- case PENG :
- krawumm(1);
- return(0);
- case GRENADE:
- KillTimer(hWnd, GRENADE);
- grenade_ready = TRUE;
- krawumm(2);
- if (soundinstalled)
- {
- StopSound();
- SetVoiceSound(1, (long)(200) << 16, EXPLOSIONDELAY);
- StartSound();
- explosion_counter=EXPLOSIONNUMBER;
- speaker_explosion = TRUE;
- }
- SetTimer(hWnd, ENDGRENADE, soundinstalled?EXPLOSIONDELAY:ENDDELAY, NULL);
- case ENDGRENADE:
- OwnMciSendString("status krawumm mode",(LPSTR)InfoStr,42,0,"Error 6");
- if ((soundinstalled) || (strcmp(InfoStr,OldInfoStr) != 0))
- {
- if (soundinstalled)
- {
- StopSound();
- if (explosion_counter--)
- {
- SetVoiceSound(1, (long)(100+random(100)) << 16, EXPLOSIONDELAY);
- StartSound();
- }
- else
- {
- speaker_explosion = FALSE;
- explosion_counter = 0;
- KillTimer(hWnd,ENDGRENADE);
- }
- }
- return(0);
- }
- else
- {
- KillTimer(hWnd,ENDGRENADE);
- return(0);
- }
- case HASTALAVISTA:
- OwnMciSendString("status hlvb mode",(LPSTR)InfoStr,42,0,"Error 7");
- grenade_ready = TRUE;
- if ((soundinstalled) || (strcmp(InfoStr,OldInfoStr) != 0))
- {
- /*CloseMciDriver();*/
- KillTimer(hWnd,HASTALAVISTA);
- if (soundinstalled)
- {
- CloseSound();
- soundinstalled = FALSE;
- }
- return(0);
- }
- else
- {
- return(0);
- }
- }
-
- case WM_LBUTTONDOWN :
- if (ballerbumm) {
- krawumm(1);
- SetTimer(hWnd, PENG, 501-FireSpeed, NULL);
- return(0);
- }
- break;
- case WM_RBUTTONDBLCLK :
- if (ballerbumm) {
- KillTimer(hWnd, PENG);
- KillTimer(hWnd, GRENADE);
- KillTimer(hWnd, ENDGRENADE);
- ballerbumm = 0;
- OwnMciSendString("stop bumm",(LPSTR)NULL,0,0,"Error 8");
- OwnMciSendString("stop krawumm",(LPSTR)NULL,0,0,"Error 9");
- OwnMciSendString("play hlvb from 0",(LPSTR)NULL,0,0,"Error 10");
- ReleaseCapture();
- SetCursor(gaehn_cursor);
- OwnMciSendString("status hlvb mode",(LPSTR)OldInfoStr,42,0,"Error 11");
- if (!soundinstalled)
- SetTimer(hWnd, HASTALAVISTA, ENDDELAY, NULL);
- return(0);
- }
- break;
- case WM_RBUTTONDOWN :
- if (ballerbumm && grenade_ready)
- {
- grenade_ready = FALSE;
- GetCursorPos((LPPOINT)&ptcursorpos);
- grenade_x = ptcursorpos.x - ptSize_grenade.x/2;
- grenade_y = ptcursorpos.y - ptSize_grenade.y/2;
- OwnMciSendString("stop bumm",(LPSTR)NULL,0,0,"Error 12");
- OwnMciSendString("stop krawumm",(LPSTR)NULL,0,0,"Error 13");
- OwnMciSendString("play krawumm from 0",(LPSTR)NULL,0,0,"Error 14");
- OwnMciSendString("status krawumm mode",(LPSTR)OldInfoStr,42,0,"Error 15");
- SetTimer(hWnd, GRENADE, GrenadeDelay, NULL);
- }
- return(0);
- case WM_SYSCOMMAND:
- switch (wParam)
- {
- case IDM_SYSABOUT:
- lpAboutProc = MakeProcInstance(AboutBox, scheiss_c);
- DialogBox(scheiss_c, "MEGAABOUT", hWnd, lpAboutProc);
- FreeProcInstance(lpAboutProc);
- break;
- case IDM_ABOUTABOUT:
- lpAboutProc = MakeProcInstance(AboutBox, scheiss_c);
- DialogBox(scheiss_c, "ABOUTABOUT", hWnd, lpAboutProc);
- FreeProcInstance(lpAboutProc);
- break;
- case IDM_CONFIG:
- lpConfigProc = MakeProcInstance(ConfigBox, scheiss_c);
- DialogBox(scheiss_c, "CONFIG", hWnd, lpConfigProc);
- FreeProcInstance(lpConfigProc);
- break;
- case IDM_STATS:
- lpStatistikProc = MakeProcInstance(StatistikBox, scheiss_c);
- DialogBox(scheiss_c, "STATISTIK", hWnd, lpStatistikProc);
- FreeProcInstance(lpStatistikProc);
- break;
- case IDM_HELP:
- strcpy(test,WhereBang);
- strcat(test,"\\BANG.HLP");
- WinHelp(hWnd,test,HELP_INDEX,NULL);
-
- break;
- }
- break;
- case WM_DESTROY :
- KillTimer(hWnd,HASTALAVISTA);
- if (hdc_in_use)
- {
- DeleteDC(hdcvar);
- DeleteDC(hdcmem);
- hdc_in_use = FALSE;
- }
- CloseMciDriver();
- if (soundinstalled)
- {
- CloseSound();
- soundinstalled = FALSE;
- }
- restorescreen();
- PostQuitMessage (0);
-
- /* Back to where the action is... */
- return(0);
- }
- if (ballerbumm)
- return(0);
- else
- return (DefWindowProc (hWnd, uiMessage, wParam, lParam));
-
- } /* this was the window function */
-
- /* ----- AboutBox -------------------------------------------------------
- *
- * About box function
- * ---------------------------------------------------------------------- */
- BOOL FAR PASCAL AboutBox(hDialog, uiMeldung, wParam, lParam)
-
- #pragma argsused
-
- HWND hDialog; /* Dialog box handle */
- unsigned uiMeldung; /* Dialog box message */
- WORD wParam; /* wParam und lParam contain */
- LONG lParam; /* additional informations */
- {
- switch (uiMeldung){
-
- /* Dialog box initialized: only default actions */
- case WM_INITDIALOG:
- return(TRUE);
-
- /* User likes to keep on firing */
- case WM_COMMAND:
- if (wParam == ID_OK)
- {
- EndDialog(hDialog, TRUE);
- return(TRUE);
- }
- break;
- }
- return(FALSE);
- }
- /* ----- ConfigurationBox -----------------------------------------------
- *
- * Configuration box function
- * ---------------------------------------------------------------------- */
- BOOL FAR PASCAL ConfigBox(hDialog, uiMeldung, wParam, lParam)
-
- #pragma argsused
-
- HWND hDialog; /* Dialog box handle */
- unsigned uiMeldung; /* Dialog box message */
- WORD wParam; /* wParam und lParam contain */
- LONG lParam; /* additional informations */
- {
-
- BOOL btest;
- int i;
- long newdelay;
- char Buffer[100];
- char *detecterror;
-
- switch (uiMeldung)
- {
-
- /* Where is the Sound? */
- case WM_INITDIALOG:
- FirePlace=FireSpeed;
- oldgrenade=GrenadeDelay;
- itoa(GrenadeDelay,strGrenadeDelay,10);
- SetDlgItemText(hDialog,ID_MG,(LPSTR)MachineGun);
- SetDlgItemText(hDialog,ID_GT,(LPSTR)GrenadeThrower);
- SetDlgItemText(hDialog,ID_HLVB,(LPSTR)HastaLaVista);
- SetDlgItemText(hDialog,ID_PATHTOSOUND,(LPSTR)WhereBang);
- SetDlgItemInt(hDialog,ID_SPEED,FirePlace,FALSE);
- SetDlgItemText(hDialog,ID_GRENADEDELAY,strGrenadeDelay);
- for (i = 0; i< 3; i++)
- SendDlgItemMessage (hDialog,ID_SOUNDMODE,CB_ADDSTRING, 0,
- (LONG)(LPSTR)SoundModeStrings[i]);
- SendDlgItemMessage (hDialog,ID_SOUNDMODE,CB_SELECTSTRING, 0,
- (LONG)(LPSTR)SoundModeStrings[MCImode]);
-
- hSlider=GetDlgItem(hDialog,ID_SLIDER);
- SetScrollRange(hSlider, SB_CTL, 1, 500, TRUE);
- SetScrollPos(hSlider, SB_CTL, FirePlace, TRUE);
- return(TRUE);
- /* User wants to say something */
- case WM_VSCROLL:
- switch(wParam)
- {
- case SB_BOTTOM:
- FirePlace=1; break;
- case SB_TOP:
- FirePlace=500; break;
- case SB_LINEDOWN:
- if (FirePlace<500)
- FirePlace++;
- break;
- case SB_LINEUP:
- if (FirePlace>1)
- FirePlace--;
- break;
- case SB_PAGEUP:
- if (FirePlace>100)
- FirePlace-=100;
- else
- FirePlace=1;
- break;
- case SB_PAGEDOWN:
- if (FirePlace<401)
- FirePlace+=100;
- else
- FirePlace=500;
- break;
- case SB_THUMBTRACK:
- FirePlace=LOWORD(lParam);
- break;
- }
- SetDlgItemInt(hDialog,ID_SPEED, FirePlace, FALSE);
- SetScrollPos(hSlider, SB_CTL, FirePlace, TRUE);
- case WM_COMMAND:
- switch (wParam)
- {
- case ID_FORGET:
- GrenadeDelay=oldgrenade;
- EndDialog(hDialog, FALSE);
- return(FALSE);
- case ID_SOUNDMODE:
- GetDlgItemText (hDialog,ID_SOUNDMODE,Buffer, 100);
- for (i = 0; i< 3; i++)
- if (strcmpi(Buffer,SoundModeStrings[i])==0)
- MCImode=i;
- return(TRUE);
- case ID_GRENADEDELAY:
- GetDlgItemText(hDialog,ID_GRENADEDELAY,(LPSTR)Buffer,100);
- newdelay=strtol(Buffer,&detecterror,10);
- for(i=strlen(Buffer);i>0 && Buffer[i-1]==' ';i--,Buffer[i]=0);
- if (*detecterror != 0 || newdelay < 0 || newdelay > 30000)
- {
- MessageBeep(0);
- SetDlgItemText(hDialog,ID_GRENADEDELAY,strGrenadeDelay);
- return(FALSE);
- }
- else
- {
- GrenadeDelay = newdelay;
- return(TRUE);
- }
- case ID_SAVE:
- GetDlgItemText(hDialog,ID_MG,(LPSTR)MachineGun,13);
- GetDlgItemText(hDialog,ID_GT,(LPSTR)GrenadeThrower,13);
- GetDlgItemText(hDialog,ID_HLVB,(LPSTR)HastaLaVista,13);
- GetDlgItemText(hDialog,ID_PATHTOSOUND,(LPSTR)WhereBang,50);
- GetDlgItemText(hDialog,ID_GRENADEDELAY,(LPSTR)strGrenadeDelay,50);
- FireSpeed=GetDlgItemInt(hDialog,ID_SPEED,&btest,FALSE);
- WriteProfileString("BANG","MachineGun",(LPSTR)MachineGun);
- WriteProfileString("BANG","GrenadeThrower",(LPSTR)GrenadeThrower);
- WriteProfileString("BANG","HastaLaVista",(LPSTR)HastaLaVista);
- WriteProfileString("BANG","WhereBang",(LPSTR)WhereBang);
- itoa(FireSpeed,strFireSpeed,10);
- WriteProfileString("BANG","Firespeed",(LPSTR)strFireSpeed);
- itoa(GrenadeDelay,strGrenadeDelay,10);
- WriteProfileString("BANG","GrenadeDelay",(LPSTR)strGrenadeDelay);
- WriteProfileString("BANG","SoundMode",(LPSTR)SoundModeStrings[MCImode]);
- EndDialog(hDialog, TRUE);
- return(TRUE);
-
- }
- break;
- default:
- return(FALSE);
- }
- return(FALSE);
- }
- /* ----- StatistikBox ---------------------------------------------------
- *
- * statistic box function
- * ---------------------------------------------------------------------- */
- BOOL FAR PASCAL StatistikBox(hDialog, uiMeldung, wParam, lParam)
-
- #pragma argsused
-
- HWND hDialog; /* Dialog box handle */
- unsigned uiMeldung; /* Dialog box message */
- WORD wParam; /* wParam und lParam contain */
- LONG lParam; /* additional informations */
- {
-
- BOOL btest;
-
- switch (uiMeldung)
- {
-
- /* Where is the Sound? */
- case WM_INITDIALOG:
- SetDlgItemInt(hDialog,ID_SHOTS,ShotsOnWinDoom, FALSE);
- SetDlgItemInt(hDialog,ID_GRENADES,ThrownGrenades, FALSE);
- return(TRUE);
- case WM_COMMAND:
- switch (wParam)
- {
- case ID_OK:
- EndDialog(hDialog, TRUE);
- return(TRUE);
- case ID_RESET:
- ShotsOnWinDoom=0;
- ThrownGrenades=0;
- SetDlgItemInt(hDialog,ID_SHOTS,ShotsOnWinDoom,FALSE);
- SetDlgItemInt(hDialog,ID_GRENADES,ThrownGrenades,FALSE);
- break;
- }
- break;
- default:
- return(FALSE);
- }
- return(FALSE);
- }
-